package com.sandasai.action.student;
import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.sandasai.service.StudentManager;
@Controller
@Scope("prototype")
public class SubmitExperienceTextAction extends ActionSupport {
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String experienceText;
	@Resource
	private StudentManager studentManager;
    public String getExperienceText() {
        return experienceText;
    }
    public void setExperienceText(String experienceText) {
        this.experienceText = experienceText;
    }
    /**
     * @return
     */
    public String execute() {
        ActionContext ctx = ActionContext.getContext();
        if(studentManager.submitExperienceText(experienceText, (String) ctx.getSession().get("username"))) {
            ctx.put("message", "提交成功！");
            return SUCCESS;
        }else {
            ctx.put("message", "提交失败！");
            return ERROR;
        }
    }
}